package Lee_code;

public class Lee_494_dp
{
    public int findTargetSumWays(int[] nums, int target)
    {
        int len = nums.length;
        if(target + len % 2 ==1)
            return -1;

        int[] dp = new int[target+1];
        dp[0] = 1;

        for(int i=0; i< nums.length; i++)
        {
            for(int j = target; j>=0; j--)
            {
                dp[j] = dp[j] + dp[j-i];
            }
        }
        return dp[target+1];
    }
}
